<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>将 Array 类型变成 Object 类型</title>
</head>
<body>
    <script>
        var obj1 = [1,10,100];
        var obj2 = {};
        for(var arr = 0;arr < obj1.length;arr++){// 遍历数组
            obj2[arr] = obj1[arr];// obj2[arr]等于obj1[arr]，这样就可以完成Array类型转换成Object类型
        }
        console.log(obj2);
        // 输出结果为：{0:1,1:10,2:100}
    </script>
</body>
</html>